<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/TemplateUsuario.xhtml">

    <ui:define name="body">
		<h1><h:outputText value="#{messages.alterarPerfil}" /></h1>
		
		<h:form id="perfilForm" enctype="multipart/form-data">
			
			<rich:simpleTogglePanel switchType="client" height="400">
				
				<f:facet name="header">
					<h:outputText value="#{messages.informacoesPerfil}" />
				</f:facet>
					
				<h:panelGrid columns="1">
					
					<s:decorate template="layout/edit.xhtml">
						<ui:define name="label">
							<h:outputText value="#{messages.nome}" />
						</ui:define>
		
						<h:inputText value="#{perfilCtrl.usuario.nome}" size="40" required="true" />
					</s:decorate>
		
					<s:decorate template="layout/edit.xhtml">
						<ui:define name="label">
							<h:outputText value="#{messages.email}" />
						</ui:define>
		
						<h:inputText value="#{perfilCtrl.usuario.email}" size="40" required="true" />
					</s:decorate>
		
					<s:decorate template="layout/edit.xhtml">
						<ui:define name="label">
							<h:outputText value="#{messages.login}" />
						</ui:define>
		
						<h:inputText value="#{perfilCtrl.usuario.login}" required="true" />
					</s:decorate>
		
					<s:decorate template="layout/edit.xhtml">
						<ui:define name="label">
							<h:outputText value="#{messages.senha}" />
						</ui:define>
		
						<h:inputSecret value="#{perfilCtrl.senha}" required="#{perfilCtrl.usuario.id == null}" />
					</s:decorate>
					
					<s:decorate template="layout/edit.xhtml">
						<ui:define name="label">
							<h:outputText value="#{messages.confirmarSenha}" />
						</ui:define>
		
						<h:inputSecret value="#{perfilCtrl.confirmarSenha}" required="#{perfilCtrl.usuario.id == null}" />
					</s:decorate>
		
					<s:decorate template="layout/edit.xhtml">
						<ui:define name="label">
							<h:outputText value="#{messages.imagemPerfil}" />
						</ui:define>
		
						<s:fileUpload data="#{perfilCtrl.usuario.imagem}" accept="image/gif"
							value="#{perfilCtrl.usuario.imagem}" />
					</s:decorate>
					
				</h:panelGrid>
			
			</rich:simpleTogglePanel>
			
			<rich:spacer height="10" />
			
			<rich:simpleTogglePanel switchType="client" height="150">
				<f:facet name="header">
					<h:outputText value="#{messages.tagsPerfil}" />
				</f:facet>
				<s:div style="height: 150px;">
					<h:panelGrid columns="1">
						<h:selectManyCheckbox value="#{perfilCtrl.usuario.tagList}" layout="pageDirection">
							<s:selectItems var="tag" value="#{perfilCtrl.todasTags}" label="#{tag.id}" />
							<s:convertEntity />
						</h:selectManyCheckbox>
					</h:panelGrid>
				</s:div>
			</rich:simpleTogglePanel>
			
			<div style="clear: both;" />
			
			<s:div styleClass="actionButtons">
				<h:commandButton action="#{perfilCtrl.salvar}" value="#{messages.actionSave}" />
				<h:commandButton action="/home.xhtml" value="#{messages.actionCancelar}" immediate="true" />
			</s:div>

		</h:form>
    </ui:define>
</ui:composition>
